package com.gexiaobao.pigeon.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gexiaobao.pigeon.R;

import java.util.List;

/**
 * @Author : hxw
 * @Date : 2024/5/30 11:48
 * @Describe :
 */
public class MyAdapter extends BaseAdapter {

    private Context context;
    private List<String> mList;

    public MyAdapter(Context context, List<String> mList) {
        this.context = context;
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (null == convertView) {
            convertView = View.inflate(context, R.layout.item_popup_name, null);
        }

        TextView textView = (TextView) convertView.findViewById(R.id.tvItemPopupName);
        textView.setText(mList.get(position));
        return convertView;
    }
}
